minecraftmodcustomstufffandomcom-20200215-history
Fence
The fence type functions much like the fencing in vanilla Minecraft, in which it attempts to connect to any nearby blocks. Because fences automatically connect to nearby blocks, they don't need to store this behavior in the save files. As a result, they're one of the various types of blocks that can use Damage Values for variants. It's important to note that when making a texture for the fence, it will always be in the shape of the default fence. If you wanted to make a fence with other shapes like arches or a simple picket fence, you can try using the pane type. New Wood Fence (CS2 0.9.10) newFence_200.js id = config.getBlockId("newFenceID"); name = "newWoodFence"; displayName0 = "New Wood Fence"; material = "wood"; hardness0 = 3.0; drop0 = config.getBlockId("newFenceID"); addToCreative0 = true; creativeTab = "decorations"; textureFileXP0 = "/tree_side.png"; textureFileXN0 = "/tree_side.png"; textureFileYP0 = "/tree_top.png"; textureFileYN0 = "/tree_top.png"; textureFileZP0 = "/tree_side.png"; textureFileZN0 = "/tree_side.png"; mod.js config.addBlockIdProperty("newFenceID", 200); mod.addBlock("newFence_200.js", "fence"); Fence Block Attributes Required Attributes * displayName * id * name * textureFileXN * textureFileXP * textureFileYN * textureFileYP * textureFileZN * textureFileZP Optional Attributes * addToCreative * canPlaceOnCeiling * canPlaceOnFloor * canPlaceOnWall * canSilkHarvest * creativeTab * drop * fireSpreadSpeed * flammability * fortuneModifier * hardness * harvestLevel * hasCollision * hasTileEntity * isBeaconBase * isBurning * isFireSource * isWood * light * material * opacity * pick * resistance * semiTransparent * slipperiness * stepSound * tickrate * tileEntity * tileTransparent * toolClass * transparent textureFile and textureIndex In CS2 versions for 1.4.7 and below, CS2 0.9.9 or below, textureFile was used to specify the texture sheet and textureIndex was used for identifying the specific icon within the texture sheet. If using CS2 0.9.9 or lower, make sure to use both of these attributes. Example Fence Block name="Glowing Perimeter Fence"; id=215; texturefile="terrain.png"; textureindex=105; type="fence"; material="glass"; stepsound="glass"; hardness=0.3; resistance=1; iddropped=215; opacity=0; light=15; movebypiston=true; harvestlevel=0; toolclass="pickaxe"; Fence Block Attributes Below is a table of attributes available to fence-type blocks, including information on notable attributes. Required Attributes * name * id * type * texturefile * textureindex * opacity * harvestlevel * toolclass Optional Attributes * material * stepsound * hardness * resistance * damagevalues * light * iddropped * quantitydropped * damagedropped * transparent * collision * speed * gravity * movebypiston * addtocreative * color * container * maxstack type This must be set to 'fence' in order for the block to function as a fence. opacity Setting this attribute to a low value prevents a rather pronounced visual bug. See Importance of the Opacity Attribute below. Behavior Fences will act as though they are roughly 1.5 blocks in height, despite being only a single block tall. This is to prevent most mobs, including players and animals, from simply jumping over them. In this way fences are an effective way to create a barrier that doesn't also block line of sight. Fences of all types will attempt to connect to blocks adjacent to them. All fences will connect properly to Fence gates. They won't connect to other fences with different block IDs, however they will connect to other damage values of their own ID. Importance of the Opacity Attribute When making fences the opacity attribute should always be set to a value of ten or less even if the the material being used is not intrinsically translucent. This is done to prevent a visual 'bug', demonstrated by the picture at left, which causes a shadow on the geometry of the fence and the blocks adjacent to it, regardless of light level. This 'glitch' occurs because Minecraft calculates the light level of the area 'inside' the area block based on what's immediately below it. Because a block with default opacity or high opacity filters out all light. The boundary of the fence block (the box you see when you place your reticule on it) forces the game to calculate the light level as being 0 on the ground beneath the fence. Setting the opacity to a low value fixes this issue. This is also why stairs, slabs, and doors in the vanilla game don't block light entirely even when they logically should. Category:Block Types Category:Examples Category:Examples (CS1) Category:Examples (CS2)